<!DOCTYPE html>
<html class="no-js" lang="zxx">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <title>Manage Applications - JobGrids Job Portal HTML Template.</title>
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="shortcut icon" type="image/x-icon" href="assets/images/favicon.svg" />
    <!-- Place favicon.ico in the root directory -->

    <!-- Web Font -->
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
        rel="stylesheet">

    <!-- ========================= CSS here ========================= -->
    <link rel="stylesheet" href="assets/css/bootstrap.min.css" />
    <link rel="stylesheet" href="assets/css/LineIcons.2.0.css" />
    <link rel="stylesheet" href="assets/css/animate.css" />
    <link rel="stylesheet" href="assets/css/tiny-slider.css" />
    <link rel="stylesheet" href="assets/css/glightbox.min.css" />
    <link rel="stylesheet" href="assets/css/main.css" />

</head>

<body>
    <!--[if lte IE 9]>
      <p class="browserupgrade">
        You are using an <strong>outdated</strong> browser. Please
        <a href="https://browsehappy.com/">upgrade your browser</a> to improve
        your experience and security.
      </p>
    <![endif]-->

    <div id="loading-area"></div>

    <!-- Start Header Area -->
    <header class="header">
      <div class="navbar-area">
        <div class="container">

          <div class="row align-items-center">

            <div class="col-lg-12">
              <nav class="navbar navbar-expand-lg">
                <a class="navbar-brand logo" href="index.html">
                  <img class="logo1" src="assets/images/logo/logo.svg" alt="Logo" />
                </a>
                <button class="navbar-toggler" type="button" data-toggle="collapse"
                        data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">
                  <span class="toggler-icon"></span>
                  <span class="toggler-icon"></span>
                  <span class="toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse sub-menu-bar" id="navbarSupportedContent">
                  <ul id="nav" class="navbar-nav ml-auto">
                    <li class="nav-item">
                      <a  href="index.html">主页</a>
                    </li>



                    <li class="nav-item">
                      <a  href="browse-jobs.html">职位搜索</a>
                    </li>



                    <li class="nav-item">
                      <a href="blog-grid-sidebar.html">论坛</a></li>
                    </li>

                    <li class="nav-item"><a href="contact.html">联系我们 </a> </li>


                    <li class="nav-item"><a href="#">其他</a>
                      <ul class="sub-menu">
                        <li><a href="index.html" onclick="logout()">Log Out</a></li>
                        <li><a onclick="checkloginuser()">Personal Info</a></li>
                        <li><a href="about-us.html" onclick="addtoken()">About Us</a></li>
                        <li><a href="job-list.html">Job List</a></li>
                        <li><a href="job-details.html">Job Details</a></li>
                        <li><a href="resume.html">Resume Page</a></li>
                        <li><a href="privacy-policy.html">Privacy Policy</a></li>
                        <li><a href="faq.html">Faq</a></li>
                        <li><a href="pricing.html">Our Pricing</a></li>
                        <li><a href="404.html">404 Error</a></li>
                        <li><a href="mail-success.html">Mail Success</a></li>
                      </ul>
                    </li>



                    <li class="nav-item"><a href="#" class="active">个人中心</a>
                      <ul class="sub-menu">
                        <li><a href="resume.html">简历查看</a></li>
                        <li><a  href="showseekerinfo.html">个人信息编辑</a></li>
                        <li><a href="add-resume.html">简历编辑</a></li>
                        <li><a class="active" href="manage-applications.html">申请进度</a></li>
                        <li><a href="job-alerts.html">消息提醒</a></li>
                        <li><a href="manage-blog.html">管理博客</a></li>
                      </ul>
                    </li>
                    <li class="nav-item login">

                      <a href="showseekerinfo.html" id="shownameid" >
                      </a>
                      <ul class="sub-menu">
                        <li><a href="index.html" onclick="logout()">退出登录</a></li>
                      </ul>
                    </li>
                  </ul>
                </div>


              </nav>
              <!-- navbar -->
            </div>
          </div>
          <!-- row -->
        </div>
        <!-- container -->
      </div>
      <!-- navbar area -->
    </header>
    <!-- End Header Area -->



    <!-- Main Content Start -->
    <div class="manage-applications section">
        <div class="container">
            <div class="alerts-inner">
                <div class="row">

                    <!-- Start Main Content -->
                    <div class="col-lg-4 col-12">
                        <div class="dashbord-sidebar">
                            <ul>
                                <li class="heading">个人中心</li>
                                <li><a href="resume.html"><i class="lni lni-clipboard"></i> 我的简历</a></li>
                                <li><a href="showseekerinfo.html"><i class="lni lni-upload"></i> 信息编辑</a></li>
                                <li><a href="bookmarked.html"><i class="lni lni-bookmark"></i> 收藏工作</a></li>
                                <li><a href="notifications.html"><i class="lni lni-alarm"></i> 消息提醒 <span
                                            class="notifi">5</span></a></li>
                                <li><a class="active" href="manage-applications.html"><i class="lni lni-envelope"></i>
                                        申请进度</a></li>
                                <li><a href="manage-jobs.html"><i class="lni lni-briefcase"></i> 我的工作</a></li>
                              <li><a href="manage-blog.html"><i class="lni lni-alarm"></i>管理博客</a></li>
                                <!-- <li><a href="change-password.html"><i class="lni lni-lock"></i> Change Password</a></li> -->

                            </ul>
                        </div>
                    </div>
                    <!-- End Main Content -->
                    <div class="col-lg-8 col-12">

                        <div class="job-items" id="seekerprocesstemplateid">


                        </div>
                        <!-- Pagination -->
                        <div class="pagination left pagination-md-center">
                            <ul class="pagination-list">
                                <li><a href="#" onclick="lastpage()"><i class="lni lni-arrow-left"></i></a></li>
                                <li class="active"><a href="#" onclick="changepagecontent(this)">1</a></li>

                            </ul>
                        </div>
                        <!-- End Pagination -->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Main Content end -->

                        <!-- Start Footer Area -->
<footer class="footer">
        <div class="footer-bottom">
            <div class="container">
                <div class="inner">
                    <div class="row">
                        <div class="col-lg-6 col-md-6 col-12">
                            <div class="left">
                                <p><a target="_blank" >软件工程大作业</a></p>
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-12">
                            <div class="right">
                                <ul>
                                    <li><a href="privacy-policy.html">用户手册</a></li>
                                    <li><a href="#">项目文档</a></li>
                                    <li><a href="https://gitee.com/Yuan-Wi/software-engineering-team/tree/master/">gitee</a></li>
                                    <li><a href="contact.html">联系我们</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- End Footer Middle -->
    </footer>
    <!--/ End Footer Area -->

    <!-- ========================= scroll-top ========================= -->
    <a href="#" class="scroll-top btn-hover">
        <i class="lni lni-chevron-up"></i>
    </a>

    <!-- ========================= JS here ========================= -->
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/wow.min.js"></script>
    <script src="assets/js/tiny-slider.js"></script>
    <script src="assets/js/glightbox.min.js"></script>
    <script src="assets/js/main.js"></script>
    <script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
    <!--模板引擎用于模板显示-->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.7/handlebars.min.js"></script>

    <script type="text/javascript">
      //像后端传本地浏览器保存的token（当前登录用户）主页跳转
      function checkloginuser(){
          //window.location.reload();

        $.ajax({
        url: "http://localhost:8080/mycheckloginuser",
        type: "GET",
        data: {token : window.localStorage.getItem("user")?window.localStorage.getItem("user"):"notoken"},
        success: function(result){
         // alert(result.code);
          if(result.code==200){
            if(result.msg=="hrlogin"){

            location.href="http://localhost/static/html/showhrinfo.html";
            }
            else if(result.msg=="employeelogin"){window.location.href="http://localhost/static/html/showseekerinfo.html";}
          }
          else {
            alert(result.code+result.msg);
            }
        },
        error: function(){
        alert("请刷新重试");
        },
      });

      };
    //其他业务请求从本地浏览器中存的token获取加入请求头

    function logout(){
 window.localStorage.removeItem('user');
 location.href="http://localhost/static/html/index.html";
};
    /*解析token*/
    function sparsetoken(){
    var token;
      $(function(){
      token = window.localStorage.getItem("user");//这可以得到当前登录用户的token
      alert("user="+token);
      alert(window.location.href);
      //data.data.normal_login_token为发送Ajax获取到的token信息
    var strings = token.split(".");//通过split()方法将token转为字符串数组
    //取strings[1]数组中的第二个字符进行解析
    var userinfo = JSON.parse(decodeURIComponent(escape(window.atob(strings[1].replace(/-/g, "+").replace(/_/g, "/")))));
    //然后可以拿到解析后的数据，可以console.log()打印下，roleid是在表中的id，loginrole=hrlogin或seekerlogin
    alert(userinfo.roleid+userinfo.loginrole+'userinfo');

      });
    };

    //===========最初需要完成名字的显示
      $(document).ready(function(){
             /*   alert("新方法");*/
                $.ajax({
        url: "http://localhost:8080/mylogingetusername",
        type: "GET",
        data: {token : window.localStorage.getItem("user")?window.localStorage.getItem("user"):"notoken"},
        success: function(result){
         // alert(result.code);
          if(result.code==200){
          alert(result.msg);
          document.getElementById('shownameid').textContent = "欢迎"+result.msg+"登录";
          }
          else {
            alert(result.code+result.msg);
            }
        },
        error: function(){
        alert("请刷新重试");
        },
      });
            });
            var allprocessresults;//所有的申请信息暂存，分页时不用再回去找了
//===========最初需要完成申请进度的显示
      $(document).ready(function(){
                $.ajax({
        url: "http://localhost:8080/showseekerprogressofapplication",
        type: "GET",
        dataType: "json",
        data: {token : window.localStorage.getItem("user")?window.localStorage.getItem("user"):"notoken"},
        success: function(result){
         // alert(result.code);

          //seekerprocesstemplateid
          allprocessresults=result;
          alert(result);
          //向上取整
                var pagecount = Math.ceil(result.length/4);
                var ul =  document.querySelector(".pagination-list");
                for(var i = 2 ; i <= pagecount;i++){
                var li = document.createElement("li");
                var a = document.createElement("a");
                a.href = "#";
                a.innerText = i;
                a.onclick = function() {changepagecontent(this);};
               // alert(i+"func="+a.onclick);
                li.appendChild(a);
                ul.appendChild(li);
                }
            $(".pagination-list").append('<li><a href="#" onclick="nextpage()"><i class="lni lni-arrow-right"></i></a></li>');


           var processblock = document.getElementById('seekerprocesstemplateid');
           var processtemplate = Handlebars.compile(document.getElementById('seeker-manage-template').innerHTML);
           processblock.innerHTML += processtemplate({data: result.slice(0,4)});

        },
        error: function(){
        alert("请刷新重试");
        },
      });
            });

      //==================分页跳转
      function changepagecontent(index){
            // 获取 <ul> 元素
            var ulElement = document.querySelector(".pagination-list");

            // 获取 <ul> 元素下的所有 <li> 元素
            var liElements = ulElement.getElementsByTagName('li');

            // 遍历所有 <li> 元素，去掉active
            for (var i = 0; i < liElements.length; i++) {

                liElements[i].classList.remove('active');
                }

                let page = Number(index.innerText)-1;
                liElements[page+1].classList.add('active');
                alert("当前页="+page);

                var blogblock = document.getElementById('seekerprocesstemplateid');
                var blogtemplate = Handlebars.compile(document.getElementById('seeker-manage-template').innerHTML);
                blogblock.innerHTML = blogtemplate({data: allprocessresults.slice(page*4,page*4+1)});
                blogblock.innerHTML += blogtemplate({data: allprocessresults.slice(page*4+1,page*4+4)});
      };

      //===============左箭头跳转
      function lastpage(){
              // 获取 <ul> 元素
            var ulElement = document.querySelector(".pagination-list");

            // 获取 <ul> 元素下的所有 <li> 元素
            var liElements = ulElement.getElementsByTagName('li');
            let page = 1;

            // 遍历所有 <li> 元素，去掉active
            for (var i = 0; i < liElements.length; i++) {
                if(liElements[i].classList.contains('active')){
                liElements[i].classList.remove('active');
                page=Number(liElements[i].querySelector('a').innerText)-1;
                }
            }
                page=page-1;//数组下标
                if(page<0){page=0;}
                liElements[page+1].classList.add('active');

                alert("当前页="+page);
                var blogblock = document.getElementById('seekerprocesstemplateid');
                var blogtemplate = Handlebars.compile(document.getElementById('seeker-manage-template').innerHTML);
                blogblock.innerHTML = blogtemplate({data: allprocessresults.slice(page*4,page*4+1)});
                blogblock.innerHTML += blogtemplate({data: allprocessresults.slice(page*4+1,page*4+4)});

  };
  //===============右箭头跳转
  function nextpage(){
             // 获取 <ul> 元素
            var ulElement = document.querySelector(".pagination-list");

            // 获取 <ul> 元素下的所有 <li> 元素
            var liElements = ulElement.getElementsByTagName('li');
            let page = 1;

            // 遍历所有 <li> 元素，去掉active
            for (var i = 0; i < liElements.length; i++) {
                if(liElements[i].classList.contains('active')){
                liElements[i].classList.remove('active');
                page=Number(liElements[i].querySelector('a').innerText)-1;
                }
            }
                page=page+1;
                var pagecount = Math.ceil(allprocessresults.length/4);
                if(page>=pagecount){page=pagecount-1;}

                liElements[page+1].classList.add('active');
                alert("当前页="+page);
                var blogblock = document.getElementById('seekerprocesstemplateid');
                var blogtemplate = Handlebars.compile(document.getElementById('seeker-manage-template').innerHTML);
                blogblock.innerHTML = blogtemplate({data: allprocessresults.slice(page*4,page*4+1)});
                blogblock.innerHTML += blogtemplate({data: allprocessresults.slice(page*4+1,page*4+4)});

  };




    </script>
    <!--模板显示申请进度-->
<script id="seeker-manage-template" type="text/x-handlebars-template">
  {{#each data}}
  <div class="manage-content">
    <div class="row align-items-center justify-content-center">
      <div class="col-lg-5 col-md-5">
        <div class="title-img">
          <div class="can-img">
            <img src="assets/images/jobs/manage-job1.png" alt="#">
          </div>
          <h3><a href="job-details.html?jobId={{jobId}}">{{jobname}}</a> <span>{{companyname}}</span></h3>
        </div>
      </div>
      <div class="col-lg-2 col-md-2">
        <p><span class="time">{{jobPoststat}}</span></p>
      </div>
      <div class="col-lg-3 col-md-3">
        <p>{{jobupdatedate}}</p>
      </div>
      <div class="col-lg-2 col-md-2">
        <p>{{cvResult}}</p>
      </div>
    </div>
  </div>
  {{/each}}
</script>
</body>

</html>
